export const swiperCellBehaviors =  Behavior({
    data: {
        swiperCell: []
        // 存储单元格实例
    },

    methods: {
        // 删除滑块可以点击空白处收起
        swiperCellOpen(event) {
            // 获取单元格实例
            const instance = this.selectComponent(`#${event.target.id}`)

            this.data.swiperCell.push(instance)
        },

        // 给页面添加点击事件以供删除滑块隐藏
        onSwiperCellPage() {
            this.onSwiperCellCommonClick()
        },
        
        // 给单元格添加点击事件以供删除滑块隐藏
        onSwiperCellClick() {
            this.onSwiperCellCommonClick()
        },

        onSwiperCellCommonClick() {
            this.data.swiperCell.forEach((instance) => {
                instance.close()
            })

            this.swiperCell = []
        }
    }
})